<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>动画版下拉菜单</title>
    <script src="js/jquery-3.3.1.min.js"></script>
    <style>
        * {
            padding: 0;
            margin: 0;
        }
        
        div {
            width: 330px;
            height: 24px;
            background-color: rgb(0, 162, 255);
            border-radius: 5px;
            margin-left: 100px;
            margin-top: 100px;
        }
        
        div ul li {
            float: left;
            width: 110px;
            list-style: none;
        }
        
        .hl {
            margin-top: 2px;
        }
        
        span,
        .tl {
            width: 74px;
            height: 20px;
            font-size: 16px;
            padding: 1px 10px;
            margin-left: 8px;
            margin-top: 2px;
            background-color: rgb(83, 180, 236);
        }
        
        div>ul>li>ul {
            display: none;
        }
    </style>
</head>

<body>
    <div>
        <ul>
            <li class="hl">
                <span>一级菜单1</span>
                <ul>
                    <li class="tl">二级菜单1</li>
                    <li class="tl">二级菜单2</li>
                    <li class="tl">二级菜单3</li>
                </ul>
            </li>
            <li class="hl">
                <span>一级菜单1</span>
                <ul>
                    <li class="tl">二级菜单1</li>
                    <li class="tl">二级菜单2</li>
                    <li class="tl">二级菜单3</li>
                </ul>
            </li>
            <li class="hl">
                <span>一级菜单1</span>
                <ul>
                    <li class="tl">二级菜单1</li>
                    <li class="tl">二级菜单2</li>
                    <li class="tl">二级菜单3</li>
                </ul>
            </li>
        </ul>
    </div>

    <script>
        $(function() {
            $('div>ul>li').mouseenter(function() {
                $(this).children('ul').slideDown(100)
            })

            $('div>ul>li').mouseleave(function() {
                $(this).children('ul').slideUp(300)
            })
        })
    </script>
</body>

</html>